﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter8.Section6
{
    public class Example05
    {
        public Example05()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double, double, double, double> fx
                = new V.Function.ToLastType<double, double, double, double>(dx);

            V.Function.ToLastType<double, double, double, double> fy
              = new V.Function.ToLastType<double, double, double, double>(dy);

            V.Function.ToLastType<double, double, double, double> fz
              = new V.Function.ToLastType<double, double, double, double>(dz);


            V.Function.ToLastType<double, double[]> ff
              = new V.Function.ToLastType<double, double[]>(path);
            V.Path s = new V.Path(ff);
            s.ParameterFrom = 0.0;
            s.ParameterTo = 1.0;

            V.IntegralOf1Form obj = new V.IntegralOf1Form(fx,fy,fz,s);
            obj.Compute();

            result += obj.Result.ToString() + "\r\n";
          
            result += (13.0 / 21.0).ToString() + "\r\n";
        }
        private double[] path(double t)
        {
            double[] x = new double[3];
            x[0] = t*t;
            x[1] = t*t*t;
            x[2] = 1.0;
            return x;
        }
        private double dx(double x, double y, double z)
        {
            return x*y;
        }
        private double dy(double x, double y, double z)
        {
            return y * y;
        }
        private double dz(double x, double y, double z)
        {
            return 1.0;
        }
    }
}
/*
0.619047619040514
0.619047619047619
*/

